home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / bublbobl.c < prev    next >
C/C++ Source or Header  |  2000-05-04  |  41KB  |  1,096 lines

  1. /***************************************************************************
  2.  
  3. Bobble Bobble memory map (preliminary)
  4.  
  5. driver by Chris Moore
  6.  
  7. CPU #1
  8. 0000-bfff ROM (8000-bfff is banked)
  9. c000-dcff Graphic RAM. This contains pointers to the video RAM columns and
  10.           to the sprites are contained in Object RAM.
  11. dd00-dfff Object RAM (groups of four bytes: X position, code [offset in the
  12.           Graphic RAM], Y position, gfx bank)
  13. CPU #2
  14. 0000-7fff ROM
  15.  
  16. CPU #1 AND #2
  17. e000-f7fe RAM
  18. f800-f9ff Palette RAM
  19. fc01-fdff RAM
  20.  
  21. read:
  22. ff00      DSWA
  23. ff01      DSWB
  24. ff02      IN0
  25. ff03      IN1
  26.  
  27.  
  28. Service mode works only if the language switch is set to Japanese.
  29.  
  30. - The protection feature which randomizes the EXTEND letters in the original
  31.   version is not emulated properly.
  32.  
  33.  
  34. ***************************************************************************/
  35. /***************************************************************************
  36.  
  37. Tokio memory map
  38.  
  39. CPU 1
  40. 0000-bfff ROM (8000-bfff is banked)
  41. c000-dcff Graphic RAM. This contains pointers to the video RAM columns and
  42.           to the sprites contained in Object RAM.
  43. dd00-dfff Object RAM (groups of four bytes: X position, code [offset in the
  44.           Graphic RAM], Y position, gfx bank)
  45. e000-f7ff RAM (Shared)
  46. f800-f9ff Palette RAM
  47.  
  48. fa03 - DSW0
  49. fa04 - DSW1
  50. fa05 - Coins
  51. fa06 - Controls Player 1
  52. fa07 - Controls Player 1
  53.  
  54. CPU 2
  55. 0000-7fff ROM
  56. 8000-97ff RAM (Shared)
  57.  
  58. CPU 3
  59. 0000-7fff ROM
  60. 8000-8fff RAM
  61.  
  62.  
  63.   Here goes a list of known deficiencies of our drivers:
  64.  
  65.   - The bootleg romset is functional. The original one hangs at
  66.     the title screen. This is because Fredrik and I have worked
  67.     on the first one, and got mostly done. Later Victor added support
  68.     for the original set (mainly sound), which is still deficient.
  69.  
  70.   - Score saving is still wrong, I think.
  71.  
  72.   - Sound support is probably incomplete. There are a couple of unknown
  73.     accesses done by the CPU, including to the YM2203 I/O ports. At the
  74.     very least, there should be some filters.
  75.  
  76.   - "fake-r" routine make the "original" roms to restart the game after
  77.     some seconds.
  78.  
  79.     Well, we know very little about the 0xFE00 address. It could be
  80.     some watchdog or a synchronization timer.
  81.  
  82.     I remember scanning the main CPU code to find how it was
  83.     used on the bootleg set. Then I just figured out a constant value
  84.     that made the game run (it hang if just set unhandled, that is,
  85.     returning zero).
  86.  
  87.     Maybe the solution is to patch the bootleg ROMs to skip some tests
  88.     at this location (I remember some of them being in the
  89.     initialization routine of the main CPU).
  90.  
  91.                        Marcelo de G. Malheiros <malheiro@dca.fee.unicamp.br>
  92.                                                                    1998.9.25
  93.  
  94. ***************************************************************************/
  95.  
  96. #include "driver.h"
  97. #include "vidhrdw/generic.h"
  98.  
  99.  
  100.  
  101. /* vidhrdw/bublbobl.c */
  102. extern unsigned char *bublbobl_objectram;
  103. extern size_t bublbobl_objectram_size;
  104. void bublbobl_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  105. void bublbobl_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  106.  
  107. /* machine/bublbobl.c */
  108. extern unsigned char *bublbobl_sharedram1,*bublbobl_sharedram2;
  109. READ_HANDLER( bublbobl_sharedram1_r );
  110. READ_HANDLER( bublbobl_sharedram2_r );
  111. WRITE_HANDLER( bublbobl_sharedram1_w );
  112. WRITE_HANDLER( bublbobl_sharedram2_w );
  113. int bublbobl_m68705_interrupt(void);
  114. READ_HANDLER( bublbobl_68705_portA_r );
  115. WRITE_HANDLER( bublbobl_68705_portA_w );
  116. WRITE_HANDLER( bublbobl_68705_ddrA_w );
  117. READ_HANDLER( bublbobl_68705_portB_r );
  118. WRITE_HANDLER( bublbobl_68705_portB_w );
  119. WRITE_HANDLER( bublbobl_68705_ddrB_w );
  120. WRITE_HANDLER( bublbobl_bankswitch_w );
  121. WRITE_HANDLER( tokio_bankswitch_w );
  122. WRITE_HANDLER( tokio_nmitrigger_w );
  123. READ_HANDLER( tokio_fake_r );
  124. WRITE_HANDLER( bublbobl_sound_command_w );
  125. WRITE_HANDLER( bublbobl_sh_nmi_disable_w );
  126. WRITE_HANDLER( bublbobl_sh_nmi_enable_w );
  127.  
  128.  
  129.  
  130. static struct MemoryReadAddress bublbobl_readmem[] =
  131. {
  132.     { 0x0000, 0x7fff, MRA_ROM },
  133.     { 0x8000, 0xbfff, MRA_BANK1 },
  134.     { 0xc000, 0xdfff, MRA_RAM },
  135.     { 0xe000, 0xf7ff, bublbobl_sharedram1_r },
  136.     { 0xf800, 0xf9ff, paletteram_r },
  137.     { 0xfc00, 0xfcff, bublbobl_sharedram2_r },
  138.     { -1 }  /* end of table */
  139. };
  140.  
  141. static struct MemoryWriteAddress bublbobl_writemem[] =
  142. {
  143.     { 0x0000, 0xbfff, MWA_ROM },
  144.     { 0xc000, 0xdcff, MWA_RAM, &videoram, &videoram_size },
  145.     { 0xdd00, 0xdfff, MWA_RAM, &bublbobl_objectram, &bublbobl_objectram_size },
  146.     { 0xe000, 0xf7ff, bublbobl_sharedram1_w, &bublbobl_sharedram1 },
  147.     { 0xf800, 0xf9ff, paletteram_RRRRGGGGBBBBxxxx_swap_w, &paletteram },
  148.     { 0xfa00, 0xfa00, bublbobl_sound_command_w },
  149.     { 0xfa80, 0xfa80, watchdog_reset_w },    /* not sure - could go to the 68705 */
  150.     { 0xfb40, 0xfb40, bublbobl_bankswitch_w },
  151.     { 0xfc00, 0xfcff, bublbobl_sharedram2_w, &bublbobl_sharedram2 },
  152.     { -1 }  /* end of table */
  153. };
  154.  
  155. static struct MemoryReadAddress m68705_readmem[] =
  156. {
  157.     { 0x0000, 0x0000, bublbobl_68705_portA_r },
  158.     { 0x0001, 0x0001, bublbobl_68705_portB_r },
  159.     { 0x0002, 0x0002, input_port_0_r },    /* COIN */
  160.     { 0x0010, 0x007f, MRA_RAM },
  161.     { 0x0080, 0x07ff, MRA_ROM },
  162.     { -1 }    /* end of table */
  163. };
  164.  
  165. static struct MemoryWriteAddress m68705_writemem[] =
  166. {
  167.     { 0x0000, 0x0000, bublbobl_68705_portA_w },
  168.     { 0x0001, 0x0001, bublbobl_68705_portB_w },
  169.     { 0x0004, 0x0004, bublbobl_68705_ddrA_w },
  170.     { 0x0005, 0x0005, bublbobl_68705_ddrB_w },
  171.     { 0x0010, 0x007f, MWA_RAM },
  172.     { 0x0080, 0x07ff, MWA_ROM },
  173.     { -1 }    /* end of table */
  174. };
  175.  
  176.  
  177. static struct MemoryReadAddress boblbobl_readmem[] =
  178. {
  179.     { 0x0000, 0x7fff, MRA_ROM },
  180.     { 0x8000, 0xbfff, MRA_BANK1 },
  181.     { 0xc000, 0xdfff, MRA_RAM },
  182.     { 0xe000, 0xf7ff, bublbobl_sharedram1_r },
  183.     { 0xf800, 0xf9ff, paletteram_r },
  184.     { 0xfc00, 0xfcff, bublbobl_sharedram2_r },
  185.     { 0xff00, 0xff00, input_port_0_r },
  186.     { 0xff01, 0xff01, input_port_1_r },
  187.     { 0xff02, 0xff02, input_port_2_r },
  188.     { 0xff03, 0xff03, input_port_3_r },
  189.     { -1 }  /* end of table */
  190. };
  191.  
  192. static struct MemoryWriteAddress boblbobl_writemem[] =
  193. {
  194.     { 0x0000, 0xbfff, MWA_ROM },
  195.     { 0xc000, 0xdcff, MWA_RAM, &videoram, &videoram_size },
  196.     { 0xdd00, 0xdfff, MWA_RAM, &bublbobl_objectram, &bublbobl_objectram_size },
  197.     { 0xe000, 0xf7ff, bublbobl_sharedram1_w, &bublbobl_sharedram1 },
  198.     { 0xf800, 0xf9ff, paletteram_RRRRGGGGBBBBxxxx_swap_w, &paletteram },
  199.     { 0xfa00, 0xfa00, bublbobl_sound_command_w },
  200.     { 0xfa80, 0xfa80, MWA_NOP },
  201.     { 0xfb40, 0xfb40, bublbobl_bankswitch_w },
  202.     { 0xfc00, 0xfcff, bublbobl_sharedram2_w, &bublbobl_sharedram2 },
  203.     { -1 }  /* end of table */
  204. };
  205.  
  206. static struct MemoryReadAddress bublbobl_readmem2[] =
  207. {
  208.     { 0x0000, 0x7fff, MRA_ROM },
  209.     { 0xe000, 0xf7ff, bublbobl_sharedram1_r },
  210.     { -1 }  /* end of table */
  211. };
  212.  
  213. static struct MemoryWriteAddress bublbobl_writemem2[] =
  214. {
  215.     { 0x0000, 0x7fff, MWA_ROM },
  216.     { 0xe000, 0xf7ff, bublbobl_sharedram1_w },
  217.     { -1 }  /* end of table */
  218. };
  219.  
  220.  
  221. static struct MemoryReadAddress sound_readmem[] =
  222. {
  223.     { 0x0000, 0x7fff, MRA_ROM },
  224.     { 0x8000, 0x8fff, MRA_RAM },
  225.     { 0x9000, 0x9000, YM2203_status_port_0_r },
  226.     { 0x9001, 0x9001, YM2203_read_port_0_r },
  227.     { 0xa000, 0xa000, YM3526_status_port_0_r },
  228.     { 0xb000, 0xb000, soundlatch_r },
  229.     { 0xb001, 0xb001, MRA_NOP },    /* ??? */
  230.     { 0xe000, 0xefff, MRA_ROM },    /* space for diagnostic ROM? */
  231.     { -1 }    /* end of table */
  232. };
  233.  
  234. static struct MemoryWriteAddress sound_writemem[] =
  235. {
  236.     { 0x0000, 0x7fff, MWA_ROM },
  237.     { 0x8000, 0x8fff, MWA_RAM },
  238.     { 0x9000, 0x9000, YM2203_control_port_0_w },
  239.     { 0x9001, 0x9001, YM2203_write_port_0_w },
  240.     { 0xa000, 0xa000, YM3526_control_port_0_w },
  241.     { 0xa001, 0xa001, YM3526_write_port_0_w },
  242.     { 0xb000, 0xb000, MWA_NOP },    /* ??? */
  243.     { 0xb001, 0xb001, bublbobl_sh_nmi_enable_w },
  244.     { 0xb002, 0xb002, bublbobl_sh_nmi_disable_w },
  245.     { 0xe000, 0xefff, MWA_ROM },    /* space for diagnostic ROM? */
  246.     { -1 }    /* end of table */
  247. };
  248.  
  249.  
  250. static struct MemoryReadAddress tokio_readmem[] =
  251. {
  252.     { 0x0000, 0x7fff, MRA_ROM },
  253.     { 0x8000, 0xbfff, MRA_BANK1 },
  254.     { 0xc000, 0xdfff, MRA_RAM },
  255.     { 0xe000, 0xf7ff, bublbobl_sharedram1_r },
  256.     { 0xf800, 0xf9ff, paletteram_r },
  257.     { 0xfa03, 0xfa03, input_port_0_r },
  258.     { 0xfa04, 0xfa04, input_port_1_r },
  259.     { 0xfa05, 0xfa05, input_port_2_r },
  260.     { 0xfa06, 0xfa06, input_port_3_r },
  261.     { 0xfa07, 0xfa07, input_port_4_r },
  262.     { 0xfe00, 0xfe00, tokio_fake_r },
  263.     { -1 }  /* end of table */
  264. };
  265.  
  266. static struct MemoryWriteAddress tokio_writemem[] =
  267. {
  268.     { 0x0000, 0xbfff, MWA_ROM },
  269.     { 0xc000, 0xdcff, MWA_RAM, &videoram, &videoram_size },
  270.     { 0xdd00, 0xdfff, MWA_RAM, &bublbobl_objectram, &bublbobl_objectram_size },
  271.     { 0xe000, 0xf7ff, bublbobl_sharedram1_w, &bublbobl_sharedram1 },
  272.     { 0xf800, 0xf9ff, paletteram_RRRRGGGGBBBBxxxx_swap_w, &paletteram },
  273.     { 0xfa00, 0xfa00, MWA_NOP },
  274.     { 0xfa80, 0xfa80, tokio_bankswitch_w },
  275.     { 0xfb00, 0xfb00, MWA_NOP }, /* ??? */
  276.     { 0xfb80, 0xfb80, tokio_nmitrigger_w },
  277.     { 0xfc00, 0xfc00, bublbobl_sound_command_w },
  278.     { 0xfe00, 0xfe00, MWA_NOP }, /* ??? */
  279.     { -1 }  /* end of table */
  280. };
  281.  
  282. static struct MemoryReadAddress tokio_readmem2[] =
  283. {
  284.     { 0x0000, 0x7fff, MRA_ROM },
  285.     { 0x8000, 0x97ff, bublbobl_sharedram1_r },
  286.     { -1 }  /* end of table */
  287. };
  288.  
  289. static struct MemoryWriteAddress tokio_writemem2[] =
  290. {
  291.     { 0x0000, 0x7fff, MWA_ROM },
  292.     { 0x8000, 0x97ff, bublbobl_sharedram1_w },
  293.     { -1 }  /* end of table */
  294. };
  295.  
  296. static struct MemoryReadAddress tokio_sound_readmem[] =
  297. {
  298.     { 0x0000, 0x7fff, MRA_ROM },
  299.     { 0x8000, 0x8fff, MRA_RAM },
  300.     { 0x9000, 0x9000, soundlatch_r },
  301. //    { 0x9800, 0x9800, MRA_NOP },    /* ??? */
  302.     { 0xb000, 0xb000, YM2203_status_port_0_r },
  303.     { 0xb001, 0xb001, YM2203_read_port_0_r },
  304.     { 0xe000, 0xefff, MRA_ROM },    /* space for diagnostic ROM? */
  305.     { -1 }    /* end of table */
  306. };
  307.  
  308. static struct MemoryWriteAddress tokio_sound_writemem[] =
  309. {
  310.     { 0x0000, 0x7fff, MWA_ROM },
  311.     { 0x8000, 0x8fff, MWA_RAM },
  312. //    { 0x9000, 0x9000, MWA_NOP },    /* ??? */
  313.     { 0xa000, 0xa000, bublbobl_sh_nmi_disable_w },
  314.     { 0xa800, 0xa800, bublbobl_sh_nmi_enable_w },
  315.     { 0xb000, 0xb000, YM2203_control_port_0_w },
  316.     { 0xb001, 0xb001, YM2203_write_port_0_w },
  317.     { 0xe000, 0xefff, MWA_ROM },    /* space for diagnostic ROM? */
  318.     { -1 }    /* end of table */
  319. };
  320.  
  321.  
  322.  
  323. INPUT_PORTS_START( bublbobl )
  324.     PORT_START      /* IN0 */
  325.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT )
  326.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN3 )
  327.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
  328.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
  329.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  330.  
  331.     PORT_START      /* DSW0 */
  332.     PORT_DIPNAME( 0x01, 0x00, "Language" )
  333.     PORT_DIPSETTING(    0x01, "Japanese" )
  334.     PORT_DIPSETTING(    0x00, "English" )
  335.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
  336.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  337.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  338.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  339.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
  340.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  341.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  342.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
  343.     PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
  344.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
  345.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
  346.     PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
  347.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
  348.     PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
  349.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) )
  350.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
  351.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
  352.  
  353.     PORT_START      /* DSW1 */
  354.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
  355.     PORT_DIPSETTING(    0x02, "Easy" )
  356.     PORT_DIPSETTING(    0x03, "Medium" )
  357.     PORT_DIPSETTING(    0x01, "Hard" )
  358.     PORT_DIPSETTING(    0x00, "Hardest" )
  359.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
  360.     PORT_DIPSETTING(    0x08, "20000 80000" )
  361.     PORT_DIPSETTING(    0x0c, "30000 100000" )
  362.     PORT_DIPSETTING(    0x04, "40000 200000" )
  363.     PORT_DIPSETTING(    0x00, "50000 250000" )
  364.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
  365.     PORT_DIPSETTING(    0x10, "1" )
  366.     PORT_DIPSETTING(    0x00, "2" )
  367.     PORT_DIPSETTING(    0x30, "3" )
  368.     PORT_DIPSETTING(    0x20, "5" )
  369.     PORT_DIPNAME( 0xc0, 0xc0, "Spare" )
  370.     PORT_DIPSETTING(    0x00, "A" )
  371.     PORT_DIPSETTING(    0x40, "B" )
  372.     PORT_DIPSETTING(    0x80, "C" )
  373.     PORT_DIPSETTING(    0xc0, "D" )
  374.  
  375.     PORT_START      /* IN1 */
  376.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
  377.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  378.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
  379.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  380.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 )
  381.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
  382.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  383.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  384.  
  385.     PORT_START      /* IN2 */
  386.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_PLAYER2 )
  387.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_PLAYER2 )
  388.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
  389.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  390.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  391.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  392.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  393.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  394. INPUT_PORTS_END
  395.  
  396. INPUT_PORTS_START( boblbobl )
  397.     PORT_START      /* DSW0 */
  398.     PORT_DIPNAME( 0x01, 0x00, "Language" )
  399.     PORT_DIPSETTING(    0x00, "English" )
  400.     PORT_DIPSETTING(    0x01, "Japanese" )
  401.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Flip_Screen ) )
  402.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  403.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  404.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  405.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
  406.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  407.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  408.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
  409.     PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
  410.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
  411.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
  412.     PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
  413.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
  414.     PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
  415.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) )
  416.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
  417.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
  418.  
  419.     PORT_START      /* DSW1 */
  420.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
  421.     PORT_DIPSETTING(    0x02, "Easy" )
  422.     PORT_DIPSETTING(    0x03, "Medium" )
  423.     PORT_DIPSETTING(    0x01, "Hard" )
  424.     PORT_DIPSETTING(    0x00, "Hardest" )
  425.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
  426.     PORT_DIPSETTING(    0x08, "20000 80000" )
  427.     PORT_DIPSETTING(    0x0c, "30000 100000" )
  428.     PORT_DIPSETTING(    0x04, "40000 200000" )
  429.     PORT_DIPSETTING(    0x00, "50000 250000" )
  430.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
  431.     PORT_DIPSETTING(    0x10, "1" )
  432.     PORT_DIPSETTING(    0x00, "2" )
  433.     PORT_DIPSETTING(    0x30, "3" )
  434.     PORT_DIPSETTING(    0x20, "5" )
  435.     PORT_DIPNAME( 0xc0, 0x00, "Monster Speed" )
  436.     PORT_DIPSETTING(    0x00, "Normal" )
  437.     PORT_DIPSETTING(    0x40, "Medium" )
  438.     PORT_DIPSETTING(    0x80, "High" )
  439.     PORT_DIPSETTING(    0xc0, "Very High" )
  440.  
  441.     PORT_START      /* IN0 */
  442.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
  443.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  444.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
  445.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
  446.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 )
  447.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
  448.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  449.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  450.  
  451.     PORT_START      /* IN1 */
  452.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_PLAYER2 )
  453.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_PLAYER2 )
  454.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT ) /* ?????*/
  455.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
  456.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  457.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  458.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  459.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  460. INPUT_PORTS_END
  461.  
  462. INPUT_PORTS_START( sboblbob )
  463.     PORT_START      /* DSW0 */
  464.     PORT_DIPNAME( 0x01, 0x00, "Game" )
  465.     PORT_DIPSETTING(    0x01, "Bobble Bobble" )
  466.     PORT_DIPSETTING(    0x00, "Super Bobble Bobble" )
  467.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
  468.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  469.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  470.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  471.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
  472.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  473.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  474.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
  475.     PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
  476.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
  477.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
  478.     PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
  479.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
  480.     PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
  481.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) )
  482.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
  483.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
  484.  
  485.     PORT_START      /* DSW1 */
  486.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
  487.     PORT_DIPSETTING(    0x02, "Easy" )
  488.     PORT_DIPSETTING(    0x03, "Medium" )
  489.     PORT_DIPSETTING(    0x01, "Hard" )
  490.     PORT_DIPSETTING(    0x00, "Hardest" )
  491.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
  492.     PORT_DIPSETTING(    0x08, "20000 80000" )
  493.     PORT_DIPSETTING(    0x0c, "30000 100000" )
  494.     PORT_DIPSETTING(    0x04, "40000 200000" )
  495.     PORT_DIPSETTING(    0x00, "50000 250000" )
  496.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
  497.     PORT_DIPSETTING(    0x10, "1" )
  498.     PORT_DIPSETTING(    0x00, "2" )
  499.     PORT_DIPSETTING(    0x30, "3" )
  500.     PORT_BITX( 0,       0x20, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "100", IP_KEY_NONE, IP_JOY_NONE )
  501.     PORT_DIPNAME( 0xc0, 0x00, "Monster Speed" )
  502.     PORT_DIPSETTING(    0x00, "Normal" )
  503.     PORT_DIPSETTING(    0x40, "Medium" )
  504.     PORT_DIPSETTING(    0x80, "High" )
  505.     PORT_DIPSETTING(    0xc0, "Very High" )
  506.  
  507.     PORT_START      /* IN0 */
  508.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
  509.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  510.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
  511.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
  512.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 )
  513.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
  514.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  515.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  516.  
  517.     PORT_START      /* IN1 */
  518.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_PLAYER2 )
  519.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_PLAYER2 )
  520.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT ) /* ?????*/
  521.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
  522.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  523.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  524.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  525.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  526. INPUT_PORTS_END
  527.  
  528. INPUT_PORTS_START( tokio )
  529.     PORT_START      /* DSW0 */
  530.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
  531.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  532.     PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
  533.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
  534.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  535.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  536.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  537.     PORT_DIPNAME( 0x08, 0x08, "Demo Sounds?" )
  538.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  539.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  540.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
  541.     PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
  542.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
  543.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
  544.     PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
  545.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
  546.     PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
  547.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) )
  548.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
  549.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
  550.  
  551.     PORT_START      /* DSW1 */
  552.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) )
  553.     PORT_DIPSETTING(    0x03, "Easy" )
  554.     PORT_DIPSETTING(    0x02, "Medium" )
  555.     PORT_DIPSETTING(    0x01, "Hard" )
  556.     PORT_DIPSETTING(    0x00, "Hardest" )
  557.     PORT_DIPNAME( 0x0c, 0x08, DEF_STR( Bonus_Life ) )
  558.     PORT_DIPSETTING(    0x0C, "100000 400000" )
  559.     PORT_DIPSETTING(    0x08, "200000 400000" )
  560.     PORT_DIPSETTING(    0x04, "300000 400000" )
  561.     PORT_DIPSETTING(    0x00, "400000 400000" )
  562.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
  563.     PORT_DIPSETTING(    0x30, "3" )
  564.     PORT_DIPSETTING(    0x20, "4" )
  565.     PORT_DIPSETTING(    0x10, "5" )
  566.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "99", IP_KEY_NONE, IP_JOY_NONE )
  567.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  568.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  569.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  570.     PORT_DIPNAME( 0x80, 0x00, "Language" )
  571.     PORT_DIPSETTING(    0x00, "English" )
  572.     PORT_DIPSETTING(    0x80, "Japanese" )
  573.  
  574.     PORT_START      /* IN0 */
  575.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT )
  576.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN3 ) /* service */
  577.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
  578.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
  579.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
  580.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  581.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  582.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  583.  
  584.     PORT_START      /* IN1 */
  585.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
  586.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  587.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_2WAY )
  588.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_2WAY )
  589.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 )
  590.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
  591.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  592.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  593.  
  594.     PORT_START      /* IN2 */
  595.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL )
  596.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
  597.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_2WAY | IPF_COCKTAIL )
  598.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_2WAY | IPF_COCKTAIL )
  599.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  600.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  601.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  602.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  603. INPUT_PORTS_END
  604.  
  605.  
  606.  
  607. static struct GfxLayout charlayout =
  608. {
  609.     8,8,    /* the characters are 8x8 pixels */
  610.     256*8*8,    /* 256 chars per bank * 8 banks per ROM pair * 8 ROM pairs */
  611.     4,    /* 4 bits per pixel */
  612.     { 0, 4, 8*0x8000*8, 8*0x8000*8+4 },
  613.     { 3, 2, 1, 0, 8+3, 8+2, 8+1, 8+0 },
  614.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
  615.     16*8    /* every char takes 16 bytes in two ROMs */
  616. };
  617.  
  618. static struct GfxDecodeInfo gfxdecodeinfo[] =
  619. {
  620.     /* read all graphics into one big graphics region */
  621.     { REGION_GFX1, 0x00000, &charlayout, 0, 16 },
  622.     { -1 }    /* end of array */
  623. };
  624.  
  625.  
  626.  
  627. /* handler called by the 2203 emulator when the internal timers cause an IRQ */
  628. static void irqhandler(int irq)
  629. {
  630.     cpu_set_irq_line(2,0,irq ? ASSERT_LINE : CLEAR_LINE);
  631. }
  632.  
  633. static struct YM2203interface ym2203_interface =
  634. {
  635.     1,            /* 1 chip */
  636.     3000000,    /* 3 MHz ??? (hand tuned) */
  637.     { YM2203_VOL(25,25) },
  638.     { 0 },
  639.     { 0 },
  640.     { 0 },
  641.     { 0 },
  642.     { irqhandler }
  643. };
  644.  
  645.  
  646. static struct YM3526interface ym3526_interface =
  647. {
  648.     1,            /* 1 chip (no more supported) */
  649.     3000000,    /* 3 MHz ??? (hand tuned) */
  650.     { 255 }        /* (not supported) */
  651. };
  652.  
  653.  
  654. static struct YM2203interface tokio_ym2203_interface =
  655. {
  656.     1,        /* 1 chip */
  657.     3000000,    /* 3 MHz ??? */
  658.     { YM2203_VOL(100,20) },
  659.     { 0 },
  660.     { 0 },
  661.     { 0 },
  662.     { 0 },
  663.     { irqhandler }
  664. };
  665.  
  666.  
  667.  
  668. static struct MachineDriver machine_driver_bublbobl =
  669. {
  670.     /* basic machine hardware */
  671.     {
  672.         {
  673.             CPU_Z80,
  674.             6000000,        /* 6 Mhz??? */
  675.             bublbobl_readmem,bublbobl_writemem,0,0,
  676.             ignore_interrupt,0    /* IRQs are triggered by the 68705 */
  677.         },
  678.         {
  679.             CPU_Z80,
  680.             6000000,        /* 6 Mhz??? */
  681.             bublbobl_readmem2,bublbobl_writemem2,0,0,
  682.             interrupt,1
  683.         },
  684.         {
  685.             CPU_Z80 | CPU_AUDIO_CPU,
  686.             4000000,    /* 4 Mhz ??? */
  687.             sound_readmem,sound_writemem,0,0,
  688.             ignore_interrupt,0    /* NMIs are triggered by the main CPU */
  689.                                 /* IRQs are triggered by the YM2203 */
  690.         },
  691.         {
  692.             CPU_M68705,
  693.             4000000/2,    /* xtal is 4MHz, I think it's divided by 2 internally */
  694.             m68705_readmem,m68705_writemem,0,0,
  695.             bublbobl_m68705_interrupt,2    /* ??? should come from the same */
  696.                     /* clock which latches the INT pin on the second Z80 */
  697.         }
  698.     },
  699.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  700.     100,    /* 100 CPU slices per frame - an high value to ensure proper */
  701.             /* synchronization of the CPUs */
  702.     0,        /* init_machine() */
  703.  
  704.     /* video hardware */
  705.     32*8, 32*8,    { 0, 32*8-1, 2*8, 30*8-1 },
  706.     gfxdecodeinfo,
  707.     256, 256,
  708.     bublbobl_vh_convert_color_prom,
  709.  
  710.     VIDEO_TYPE_RASTER|VIDEO_MODIFIES_PALETTE,
  711.     0,
  712.     generic_vh_start,
  713.     generic_vh_stop,
  714.     bublbobl_vh_screenrefresh,
  715.  
  716.     /* sound hardware */
  717.     0,0,0,0,
  718.     {
  719.         {
  720.             SOUND_YM2203,
  721.             &ym2203_interface
  722.         },
  723.         {
  724.             SOUND_YM3526,
  725.             &ym3526_interface
  726.         }
  727.     }
  728. };
  729.  
  730. static struct MachineDriver machine_driver_boblbobl =
  731. {
  732.     /* basic machine hardware */
  733.     {
  734.         {
  735.             CPU_Z80,
  736.             6000000,        /* 6 Mhz??? */
  737.             boblbobl_readmem,boblbobl_writemem,0,0,
  738.             interrupt,1    /* interrupt mode 1, unlike Bubble Bobble */
  739.         },
  740.         {
  741.             CPU_Z80,
  742.             6000000,        /* 6 Mhz??? */
  743.             bublbobl_readmem2,bublbobl_writemem2,0,0,
  744.             interrupt,1
  745.         },
  746.         {
  747.             CPU_Z80 | CPU_AUDIO_CPU,
  748.             4000000,    /* 4 Mhz ??? */
  749.             sound_readmem,sound_writemem,0,0,
  750.             ignore_interrupt,0    /* NMIs are triggered by the main CPU */
  751.                                 /* IRQs are triggered by the YM2203 */
  752.         }
  753.     },
  754.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  755.     100,    /* 100 CPU slices per frame - an high value to ensure proper */
  756.             /* synchronization of the CPUs */
  757.     0,        /* init_machine() */
  758.  
  759.     /* video hardware */
  760.     32*8, 32*8,    { 0, 32*8-1, 2*8, 30*8-1 },
  761.     gfxdecodeinfo,
  762.     256, 256,
  763.     bublbobl_vh_convert_color_prom,
  764.  
  765.     VIDEO_TYPE_RASTER|VIDEO_MODIFIES_PALETTE,
  766.     0,
  767.     generic_vh_start,
  768.     generic_vh_stop,
  769.     bublbobl_vh_screenrefresh,
  770.  
  771.     /* sound hardware */
  772.     0,0,0,0,
  773.     {
  774.         {
  775.             SOUND_YM2203,
  776.             &ym2203_interface
  777.         },
  778.         {
  779.             SOUND_YM3526,
  780.             &ym3526_interface
  781.         }
  782.     }
  783. };
  784.  
  785. static struct MachineDriver machine_driver_tokio =
  786. {
  787.     /* basic machine hardware */
  788.     {        /* MachineCPU */
  789.         {       /* Main CPU */
  790.             CPU_Z80,
  791.             4000000,        /* 4 Mhz??? */
  792.             tokio_readmem,tokio_writemem,0,0,
  793.             interrupt,1
  794.         },
  795.         {       /* Video CPU */
  796.             CPU_Z80,
  797.             4000000,        /* 4 Mhz??? */
  798.             tokio_readmem2,tokio_writemem2,0,0,
  799.             interrupt,1
  800.         },
  801.         {       /* Audio CPU */
  802.             CPU_Z80 | CPU_AUDIO_CPU,
  803.             4000000,            /* 4 Mhz ??? */
  804.             tokio_sound_readmem,tokio_sound_writemem,0,0,
  805.             ignore_interrupt,0
  806.                         /* NMIs are triggered by the main CPU */
  807.                         /* IRQs are triggered by the YM2203 */
  808.         }
  809.     },
  810.     60, DEFAULT_60HZ_VBLANK_DURATION, /* frames/second, vblank duration */
  811.     100,    /* 100 CPU slices per frame - an high value to ensure proper */
  812.             /* synchronization of the CPUs */
  813.     0,    /* init_machine() */
  814.  
  815.     /* video hardware */
  816.     32*8, 32*8,    { 0, 32*8-1, 2*8, 30*8-1 },
  817.     gfxdecodeinfo,
  818.     256, 256,
  819.     bublbobl_vh_convert_color_prom,
  820.  
  821.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  822.     0,
  823.     generic_vh_start,
  824.     generic_vh_stop,
  825.     bublbobl_vh_screenrefresh,
  826.  
  827.     /* sound hardware */
  828.     0,0,0,0,
  829.     {
  830.         {
  831.             SOUND_YM2203,
  832.             &tokio_ym2203_interface
  833.         }
  834.     }
  835. };
  836.  
  837.  
  838. /***************************************************************************
  839.  
  840.   Game driver(s)
  841.  
  842. ***************************************************************************/
  843.  
  844. ROM_START( bublbobl )
  845.     ROM_REGION( 0x1c000, REGION_CPU1 )    /* 64k+64k for the first CPU */
  846.     ROM_LOAD( "a78_06.bin",   0x00000, 0x8000, 0x32c8305b )
  847.     ROM_LOAD( "a78_05.bin",   0x08000, 0x4000, 0x53f4bc6e )    /* banked at 8000-bfff. I must load */
  848.     ROM_CONTINUE(             0x10000, 0xc000 )                /* bank 0 at 8000 because the code falls into */
  849.                                                             /* it from 7fff, so bank switching wouldn't work */
  850.     ROM_REGION( 0x80000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  851.     ROM_LOAD( "a78_09.bin",   0x00000, 0x8000, 0x20358c22 )    /* 1st plane */
  852.     ROM_LOAD( "a78_10.bin",   0x08000, 0x8000, 0x930168a9 )
  853.     ROM_LOAD( "a78_11.bin",   0x10000, 0x8000, 0x9773e512 )
  854.     ROM_LOAD( "a78_12.bin",   0x18000, 0x8000, 0xd045549b )
  855.     ROM_LOAD( "a78_13.bin",   0x20000, 0x8000, 0xd0af35c5 )
  856.     ROM_LOAD( "a78_14.bin",   0x28000, 0x8000, 0x7b5369a8 )
  857.     /* 0x30000-0x3ffff empty */
  858.     ROM_LOAD( "a78_15.bin",   0x40000, 0x8000, 0x6b61a413 )    /* 2nd plane */
  859.     ROM_LOAD( "a78_16.bin",   0x48000, 0x8000, 0xb5492d97 )
  860.     ROM_LOAD( "a78_17.bin",   0x50000, 0x8000, 0xd69762d5 )
  861.     ROM_LOAD( "a78_18.bin",   0x58000, 0x8000, 0x9f243b68 )
  862.     ROM_LOAD( "a78_19.bin",   0x60000, 0x8000, 0x66e9438c )
  863.     ROM_LOAD( "a78_20.bin",   0x68000, 0x8000, 0x9ef863ad )
  864.     /* 0x70000-0x7ffff empty */
  865.  
  866.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the second CPU */
  867.     ROM_LOAD( "a78_08.bin",   0x0000, 0x08000, 0xae11a07b )
  868.  
  869.     ROM_REGION( 0x10000, REGION_CPU3 )    /* 64k for the third CPU */
  870.     ROM_LOAD( "a78_07.bin",   0x0000, 0x08000, 0x4f9a26e8 )
  871.  
  872.     ROM_REGION( 0x0800, REGION_CPU4 )    /* 2k for the microcontroller */
  873.     ROM_LOAD( "68705.bin",    0x0000, 0x0800, 0x78caa635 )    /* from a pirate board */
  874. ROM_END
  875.  
  876. ROM_START( bublbobr )
  877.     ROM_REGION( 0x1c000, REGION_CPU1 )    /* 64k+64k for the first CPU */
  878.     ROM_LOAD( "25.cpu",       0x00000, 0x8000, 0x2d901c9d )
  879.     ROM_LOAD( "24.cpu",       0x08000, 0x4000, 0xb7afedc4 )    /* banked at 8000-bfff. I must load */
  880.     ROM_CONTINUE(             0x10000, 0xc000 )                /* bank 0 at 8000 because the code falls into */
  881.                                                             /* it from 7fff, so bank switching wouldn't work */
  882.     ROM_REGION( 0x80000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  883.     ROM_LOAD( "a78_09.bin",   0x00000, 0x8000, 0x20358c22 )    /* 1st plane */
  884.     ROM_LOAD( "a78_10.bin",   0x08000, 0x8000, 0x930168a9 )
  885.     ROM_LOAD( "a78_11.bin",   0x10000, 0x8000, 0x9773e512 )
  886.     ROM_LOAD( "a78_12.bin",   0x18000, 0x8000, 0xd045549b )
  887.     ROM_LOAD( "a78_13.bin",   0x20000, 0x8000, 0xd0af35c5 )
  888.     ROM_LOAD( "a78_14.bin",   0x28000, 0x8000, 0x7b5369a8 )
  889.     /* 0x30000-0x3ffff empty */
  890.     ROM_LOAD( "a78_15.bin",   0x40000, 0x8000, 0x6b61a413 )    /* 2nd plane */
  891.     ROM_LOAD( "a78_16.bin",   0x48000, 0x8000, 0xb5492d97 )
  892.     ROM_LOAD( "a78_17.bin",   0x50000, 0x8000, 0xd69762d5 )
  893.     ROM_LOAD( "a78_18.bin",   0x58000, 0x8000, 0x9f243b68 )
  894.     ROM_LOAD( "a78_19.bin",   0x60000, 0x8000, 0x66e9438c )
  895.     ROM_LOAD( "a78_20.bin",   0x68000, 0x8000, 0x9ef863ad )
  896.     /* 0x70000-0x7ffff empty */
  897.  
  898.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the second CPU */
  899.     ROM_LOAD( "a78_08.bin",   0x0000, 0x08000, 0xae11a07b )
  900.  
  901.     ROM_REGION( 0x10000, REGION_CPU3 )    /* 64k for the third CPU */
  902.     ROM_LOAD( "a78_07.bin",   0x0000, 0x08000, 0x4f9a26e8 )
  903.  
  904.     ROM_REGION( 0x0800, REGION_CPU4 )    /* 2k for the microcontroller */
  905.     ROM_LOAD( "68705.bin",    0x0000, 0x0800, 0x78caa635 )    /* from a pirate board */
  906. ROM_END
  907.  
  908. ROM_START( bubbobr1 )
  909.     ROM_REGION( 0x1c000, REGION_CPU1 )    /* 64k+64k for the first CPU */
  910.     ROM_LOAD( "a78_06.bin",   0x00000, 0x8000, 0x32c8305b )
  911.     ROM_LOAD( "a78_21.bin",   0x08000, 0x4000, 0x2844033d )    /* banked at 8000-bfff. I must load */
  912.     ROM_CONTINUE(             0x10000, 0xc000 )                /* bank 0 at 8000 because the code falls into */
  913.                                                             /* it from 7fff, so bank switching wouldn't work */
  914.     ROM_REGION( 0x80000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  915.     ROM_LOAD( "a78_09.bin",   0x00000, 0x8000, 0x20358c22 )    /* 1st plane */
  916.     ROM_LOAD( "a78_10.bin",   0x08000, 0x8000, 0x930168a9 )
  917.     ROM_LOAD( "a78_11.bin",   0x10000, 0x8000, 0x9773e512 )
  918.     ROM_LOAD( "a78_12.bin",   0x18000, 0x8000, 0xd045549b )
  919.     ROM_LOAD( "a78_13.bin",   0x20000, 0x8000, 0xd0af35c5 )
  920.     ROM_LOAD( "a78_14.bin",   0x28000, 0x8000, 0x7b5369a8 )
  921.     /* 0x30000-0x3ffff empty */
  922.     ROM_LOAD( "a78_15.bin",   0x40000, 0x8000, 0x6b61a413 )    /* 2nd plane */
  923.     ROM_LOAD( "a78_16.bin",   0x48000, 0x8000, 0xb5492d97 )
  924.     ROM_LOAD( "a78_17.bin",   0x50000, 0x8000, 0xd69762d5 )
  925.     ROM_LOAD( "a78_18.bin",   0x58000, 0x8000, 0x9f243b68 )
  926.     ROM_LOAD( "a78_19.bin",   0x60000, 0x8000, 0x66e9438c )
  927.     ROM_LOAD( "a78_20.bin",   0x68000, 0x8000, 0x9ef863ad )
  928.     /* 0x70000-0x7ffff empty */
  929.  
  930.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the second CPU */
  931.     ROM_LOAD( "a78_08.bin",   0x0000, 0x08000, 0xae11a07b )
  932.  
  933.     ROM_REGION( 0x10000, REGION_CPU3 )    /* 64k for the third CPU */
  934.     ROM_LOAD( "a78_07.bin",   0x0000, 0x08000, 0x4f9a26e8 )
  935.  
  936.     ROM_REGION( 0x0800, REGION_CPU4 )    /* 2k for the microcontroller */
  937.     ROM_LOAD( "68705.bin",    0x0000, 0x0800, 0x78caa635 )    /* from a pirate board */
  938. ROM_END
  939.  
  940. ROM_START( boblbobl )
  941.     ROM_REGION( 0x1c000, REGION_CPU1 )    /* 64k+64k for the first CPU */
  942.     ROM_LOAD( "bb3",          0x00000, 0x8000, 0x01f81936 )
  943.     ROM_LOAD( "bb5",          0x08000, 0x4000, 0x13118eb1 )    /* banked at 8000-bfff. I must load */
  944.     ROM_CONTINUE(             0x10000, 0x4000 )                /* bank 0 at 8000 because the code falls into */
  945.                                                             /* it from 7fff, so bank switching wouldn't work */
  946.     ROM_LOAD( "bb4",          0x14000, 0x8000, 0xafda99d8 )    /* banked at 8000-bfff */
  947.  
  948.     ROM_REGION( 0x80000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  949.     ROM_LOAD( "a78_09.bin",   0x00000, 0x8000, 0x20358c22 )    /* 1st plane */
  950.     ROM_LOAD( "a78_10.bin",   0x08000, 0x8000, 0x930168a9 )
  951.     ROM_LOAD( "a78_11.bin",   0x10000, 0x8000, 0x9773e512 )
  952.     ROM_LOAD( "a78_12.bin",   0x18000, 0x8000, 0xd045549b )
  953.     ROM_LOAD( "a78_13.bin",   0x20000, 0x8000, 0xd0af35c5 )
  954.     ROM_LOAD( "a78_14.bin",   0x28000, 0x8000, 0x7b5369a8 )
  955.     /* 0x30000-0x3ffff empty */
  956.     ROM_LOAD( "a78_15.bin",   0x40000, 0x8000, 0x6b61a413 )    /* 2nd plane */
  957.     ROM_LOAD( "a78_16.bin",   0x48000, 0x8000, 0xb5492d97 )
  958.     ROM_LOAD( "a78_17.bin",   0x50000, 0x8000, 0xd69762d5 )
  959.     ROM_LOAD( "a78_18.bin",   0x58000, 0x8000, 0x9f243b68 )
  960.     ROM_LOAD( "a78_19.bin",   0x60000, 0x8000, 0x66e9438c )
  961.     ROM_LOAD( "a78_20.bin",   0x68000, 0x8000, 0x9ef863ad )
  962.     /* 0x70000-0x7ffff empty */
  963.  
  964.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the second CPU */
  965.     ROM_LOAD( "a78_08.bin",   0x0000, 0x08000, 0xae11a07b )
  966.  
  967.     ROM_REGION( 0x10000, REGION_CPU3 )    /* 64k for the third CPU */
  968.     ROM_LOAD( "a78_07.bin",   0x0000, 0x08000, 0x4f9a26e8 )
  969. ROM_END
  970.  
  971. ROM_START( sboblbob )
  972.     ROM_REGION( 0x1c000, REGION_CPU1 )    /* 64k+64k for the first CPU */
  973.     ROM_LOAD( "bbb-3.rom",    0x00000, 0x8000, 0xf304152a )
  974.     ROM_LOAD( "bb5",          0x08000, 0x4000, 0x13118eb1 )    /* banked at 8000-bfff. I must load */
  975.     ROM_CONTINUE(             0x10000, 0x4000 )                /* bank 0 at 8000 because the code falls into */
  976.                                                             /* it from 7fff, so bank switching wouldn't work */
  977.     ROM_LOAD( "bbb-4.rom",    0x14000, 0x8000, 0x94c75591 )    /* banked at 8000-bfff */
  978.  
  979.     ROM_REGION( 0x80000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  980.     ROM_LOAD( "a78_09.bin",   0x00000, 0x8000, 0x20358c22 )    /* 1st plane */
  981.     ROM_LOAD( "a78_10.bin",   0x08000, 0x8000, 0x930168a9 )
  982.     ROM_LOAD( "a78_11.bin",   0x10000, 0x8000, 0x9773e512 )
  983.     ROM_LOAD( "a78_12.bin",   0x18000, 0x8000, 0xd045549b )
  984.     ROM_LOAD( "a78_13.bin",   0x20000, 0x8000, 0xd0af35c5 )
  985.     ROM_LOAD( "a78_14.bin",   0x28000, 0x8000, 0x7b5369a8 )
  986.     /* 0x30000-0x3ffff empty */
  987.     ROM_LOAD( "a78_15.bin",   0x40000, 0x8000, 0x6b61a413 )    /* 2nd plane */
  988.     ROM_LOAD( "a78_16.bin",   0x48000, 0x8000, 0xb5492d97 )
  989.     ROM_LOAD( "a78_17.bin",   0x50000, 0x8000, 0xd69762d5 )
  990.     ROM_LOAD( "a78_18.bin",   0x58000, 0x8000, 0x9f243b68 )
  991.     ROM_LOAD( "a78_19.bin",   0x60000, 0x8000, 0x66e9438c )
  992.     ROM_LOAD( "a78_20.bin",   0x68000, 0x8000, 0x9ef863ad )
  993.     /* 0x70000-0x7ffff empty */
  994.  
  995.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the second CPU */
  996.     ROM_LOAD( "a78_08.bin",   0x0000, 0x08000, 0xae11a07b )
  997.  
  998.     ROM_REGION( 0x10000, REGION_CPU3 )    /* 64k for the third CPU */
  999.     ROM_LOAD( "a78_07.bin",   0x0000, 0x08000, 0x4f9a26e8 )
  1000. ROM_END
  1001.  
  1002. ROM_START( tokio )
  1003.     ROM_REGION( 0x30000, REGION_CPU1 )    /* main CPU */
  1004.     ROM_LOAD( "a7127-1.256", 0x00000, 0x8000, 0x8c180896 )
  1005.     /* ROMs banked at 8000-bfff */
  1006.     ROM_LOAD( "a7128-1.256", 0x10000, 0x8000, 0x1b447527 )
  1007.     ROM_LOAD( "a7104.256",   0x18000, 0x8000, 0xa0a4ce0e )
  1008.     ROM_LOAD( "a7105.256",   0x20000, 0x8000, 0x6da0b945 )
  1009.     ROM_LOAD( "a7106-1.256", 0x28000, 0x8000, 0x56927b3f )
  1010.  
  1011.     ROM_REGION( 0x80000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1012.     ROM_LOAD( "a7108.256",   0x00000, 0x8000, 0x0439ab13 )    /* 1st plane */
  1013.     ROM_LOAD( "a7109.256",   0x08000, 0x8000, 0xedb3d2ff )
  1014.     ROM_LOAD( "a7110.256",   0x10000, 0x8000, 0x69f0888c )
  1015.     ROM_LOAD( "a7111.256",   0x18000, 0x8000, 0x4ae07c31 )
  1016.     ROM_LOAD( "a7112.256",   0x20000, 0x8000, 0x3f6bd706 )
  1017.     ROM_LOAD( "a7113.256",   0x28000, 0x8000, 0xf2c92aaa )
  1018.     ROM_LOAD( "a7114.256",   0x30000, 0x8000, 0xc574b7b2 )
  1019.     ROM_LOAD( "a7115.256",   0x38000, 0x8000, 0x12d87e7f )
  1020.     ROM_LOAD( "a7116.256",   0x40000, 0x8000, 0x0bce35b6 )    /* 2nd plane */
  1021.     ROM_LOAD( "a7117.256",   0x48000, 0x8000, 0xdeda6387 )
  1022.     ROM_LOAD( "a7118.256",   0x50000, 0x8000, 0x330cd9d7 )
  1023.     ROM_LOAD( "a7119.256",   0x58000, 0x8000, 0xfc4b29e0 )
  1024.     ROM_LOAD( "a7120.256",   0x60000, 0x8000, 0x65acb265 )
  1025.     ROM_LOAD( "a7121.256",   0x68000, 0x8000, 0x33cde9b2 )
  1026.     ROM_LOAD( "a7122.256",   0x70000, 0x8000, 0xfb98eac0 )
  1027.     ROM_LOAD( "a7123.256",   0x78000, 0x8000, 0x30bd46ad )
  1028.  
  1029.     ROM_REGION( 0x10000, REGION_CPU2 )    /* video CPU */
  1030.     ROM_LOAD( "a7101.256",   0x00000, 0x8000, 0x0867c707 )
  1031.  
  1032.     ROM_REGION( 0x10000, REGION_CPU3 )    /* audio CPU */
  1033.     ROM_LOAD( "a7107.256",   0x0000, 0x08000, 0xf298cc7b )
  1034. ROM_END
  1035.  
  1036. ROM_START( tokiob )
  1037.     ROM_REGION( 0x30000, REGION_CPU1 ) /* main CPU */
  1038.     ROM_LOAD( "2",           0x00000, 0x8000, 0xf583b1ef )
  1039.     /* ROMs banked at 8000-bfff */
  1040.     ROM_LOAD( "3",           0x10000, 0x8000, 0x69dacf44 )
  1041.     ROM_LOAD( "a7104.256",   0x18000, 0x8000, 0xa0a4ce0e )
  1042.     ROM_LOAD( "a7105.256",   0x20000, 0x8000, 0x6da0b945 )
  1043.     ROM_LOAD( "6",           0x28000, 0x8000, 0x1490e95b )
  1044.  
  1045.     ROM_REGION( 0x80000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1046.     ROM_LOAD( "a7108.256",   0x00000, 0x8000, 0x0439ab13 )    /* 1st plane */
  1047.     ROM_LOAD( "a7109.256",   0x08000, 0x8000, 0xedb3d2ff )
  1048.     ROM_LOAD( "a7110.256",   0x10000, 0x8000, 0x69f0888c )
  1049.     ROM_LOAD( "a7111.256",   0x18000, 0x8000, 0x4ae07c31 )
  1050.     ROM_LOAD( "a7112.256",   0x20000, 0x8000, 0x3f6bd706 )
  1051.     ROM_LOAD( "a7113.256",   0x28000, 0x8000, 0xf2c92aaa )
  1052.     ROM_LOAD( "a7114.256",   0x30000, 0x8000, 0xc574b7b2 )
  1053.     ROM_LOAD( "a7115.256",   0x38000, 0x8000, 0x12d87e7f )
  1054.     ROM_LOAD( "a7116.256",   0x40000, 0x8000, 0x0bce35b6 )    /* 2nd plane */
  1055.     ROM_LOAD( "a7117.256",   0x48000, 0x8000, 0xdeda6387 )
  1056.     ROM_LOAD( "a7118.256",   0x50000, 0x8000, 0x330cd9d7 )
  1057.     ROM_LOAD( "a7119.256",   0x58000, 0x8000, 0xfc4b29e0 )
  1058.     ROM_LOAD( "a7120.256",   0x60000, 0x8000, 0x65acb265 )
  1059.     ROM_LOAD( "a7121.256",   0x68000, 0x8000, 0x33cde9b2 )
  1060.     ROM_LOAD( "a7122.256",   0x70000, 0x8000, 0xfb98eac0 )
  1061.     ROM_LOAD( "a7123.256",   0x78000, 0x8000, 0x30bd46ad )
  1062.  
  1063.     ROM_REGION( 0x10000, REGION_CPU2 )    /* video CPU */
  1064.     ROM_LOAD( "a7101.256",   0x00000, 0x8000, 0x0867c707 )
  1065.  
  1066.     ROM_REGION( 0x10000, REGION_CPU3 )    /* audio CPU */
  1067.     ROM_LOAD( "a7107.256",   0x0000, 0x08000, 0xf298cc7b )
  1068. ROM_END
  1069.  
  1070.  
  1071.  
  1072. #define MOD_PAGE(page,addr,data) memory_region(REGION_CPU1)[page ? addr-0x8000+0x10000+0x4000*(page-1) : addr] = data;
  1073.  
  1074. void init_boblbobl(void)
  1075. {
  1076.     /* these shouldn't be necessary, surely - this is a bootleg ROM
  1077.      * with the protection removed - so what are all these JP's to
  1078.      * 0xa288 doing?  and why does the emulator fail the ROM checks?
  1079.      */
  1080.  
  1081.     MOD_PAGE(3,0x9a71,0x00); MOD_PAGE(3,0x9a72,0x00); MOD_PAGE(3,0x9a73,0x00);
  1082.     MOD_PAGE(3,0xa4af,0x00); MOD_PAGE(3,0xa4b0,0x00); MOD_PAGE(3,0xa4b1,0x00);
  1083.     MOD_PAGE(3,0xa55d,0x00); MOD_PAGE(3,0xa55e,0x00); MOD_PAGE(3,0xa55f,0x00);
  1084.     MOD_PAGE(3,0xb561,0x00); MOD_PAGE(3,0xb562,0x00); MOD_PAGE(3,0xb563,0x00);
  1085. }
  1086.  
  1087.  
  1088.  
  1089. GAMEX( 1986, bublbobl, 0,        bublbobl, bublbobl, 0,        ROT0,  "Taito Corporation", "Bubble Bobble", GAME_NO_COCKTAIL )
  1090. GAMEX( 1986, bublbobr, bublbobl, bublbobl, bublbobl, 0,        ROT0,  "Taito America Corporation (Romstar license)", "Bubble Bobble (US set 1)", GAME_NO_COCKTAIL )
  1091. GAMEX( 1986, bubbobr1, bublbobl, bublbobl, bublbobl, 0,        ROT0,  "Taito America Corporation (Romstar license)", "Bubble Bobble (US set 2)", GAME_NO_COCKTAIL )
  1092. GAMEX( 1986, boblbobl, bublbobl, boblbobl, boblbobl, boblbobl, ROT0,  "bootleg", "Bobble Bobble", GAME_NO_COCKTAIL )
  1093. GAMEX( 1986, sboblbob, bublbobl, boblbobl, sboblbob, 0,        ROT0,  "bootleg", "Super Bobble Bobble", GAME_NO_COCKTAIL )
  1094. GAMEX( 1986, tokio,    0,        tokio,    tokio,    0,        ROT90, "Taito", "Tokio / Scramble Formation", GAME_NOT_WORKING | GAME_NO_COCKTAIL )
  1095. GAMEX( 1986, tokiob,   tokio,    tokio,    tokio,    0,        ROT90, "bootleg", "Tokio / Scramble Formation (bootleg)", GAME_NO_COCKTAIL )
  1096.